package com.lianxi.pojo.passport;
;
import com.alibaba.fastjson.annotation.JSONField;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.URL;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author yangzhenyu
 * 敏感信息加密方案：
 * 加密信息
 * 手机号(phone)|真实姓名(truename)
 * 用户名兼容方案
 * 用户名直接复制于真实姓名，且作为后续一切对外展示元素
 */
@Entity
@Table(name = "zx_user")
public class User implements Serializable {

    protected static final long serialVersionUID = 3100111186246830766L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected int uid;


    protected String username;

    @JSONField(serialize = false)
    protected String password;

    protected String phone;

    @URL(message = "头像格式不正确")
    protected String icon;
    /**
     * 加密因子
     */
    @JSONField(serialize = false)
    @Column(name = "authentication")
    protected String salt;

    @Column(columnDefinition = "tinyint")
    @Enumerated
    protected String sex;

    @Email
    protected String email;
    /**
     * 注册时间
     */
    @CreationTimestamp
    @Column(name = "create_time", updatable = false)
    protected Date createTime;

    /**
     * 注册时间
     */
    @UpdateTimestamp
    @Column(name = "update_time")
    protected Date updateTime;

    /**
     * 用户状态，正常、禁用,删除
     */
    @Column(columnDefinition = "tinyint",name = "flag")
    protected Boolean flag;

    /**
     * 真实姓名
     */
    @Column(name = "true_name")
    protected String truename;

    /**
     * 站点id
     */
    @Column(name = "department")
    protected String sid;

    /**
     * 组织机构-->部门
     */
    @Column(name = "organization", columnDefinition = "INT DEFAULT 0")
    protected int organization;
    /**
     * 职位（单独维护）
     */
    protected int job;

    /**
     * 微信唯一标识码
     */
    private String wxOpenId;

    /**
     * user area code
     */
    @Column(name = "area_code")
    private String areaCode;

    @Column(name = "synchronize_id")
    private String synchronizeId;




}
